Cytosim  PI
Cytoskeleton Simulator
FrameReader Class Reference

Detailed Description

FrameReader is used to find a particular frame (eg. frame 10) in a trajectory file, and it will handle basic IO failures. FrameReader will remember the starting points of all frames that were found, and will use this information to speed up future access to these and other frames.

FrameReader makes minimal assuptions on what constitutes a 'frame':

  • It looks for a string-tag present at the start of a frame (FRAME_TAG).
  • It calls Simul::readObjects() to actually read the simulation state.

Public Member Functions

 FrameReader ()
 constructor, after which openFile() should be called
 
virtual ~FrameReader ()
 destructor
 
void openFile (std::string &file)
 open file for input
 
void clearPositions ()
 clear the buffer
 
int lastFrame () const
 last frame seen in the file
 
bool eof ()
 true at end of file
 
bool good ()
 true if everything looks correct for input
 
void rewind ()
 rewind
 
int frame () const
 return index of current frame
 
int seekFrame (int frm)
 find the starting point of frame by brute force ! More...
 
int readFrame (Simul &, int frm, bool reload=false)
 read the frame specified by index, storing it in global variable 'sim' More...
 
int readFrameCatch (Simul &, int frm, bool reload=false)
 read the frame specified by index, storing it in global variable 'sim'
 
int readNextFrame (Simul &)
 read the next frame in the file, return 1 for EOF More...
 

Member Function Documentation

int readFrame ( Simul sim,
int  frm,
bool  reload = false 
)

returns 0 for success, an error code, or throws an exception

int readNextFrame ( Simul sim)

returns 0 for success, an error code, or throws an exception

int seekFrame ( int  frm)

scan file forward from current position to find the next occurence of FRAME_TAG

Returns
0 if the frame was found